SET(CMAKE_INCLUDE_CURRENT_DIR ON)

SET(SOURCES
Awesomium.rc
resource.h
stdint.h
api/WebCore.h
api/WebView.h
api/WebViewEvent.h
api/WebViewListener.h
javascript/ClientObject.cpp
javascript/ClientObject.h
javascript/JSValue.cpp
javascript/JSValue.h
javascript/NPApi.cpp
javascript/NPApi.h
utilities/PlatformUtils.cpp
utilities/PlatformUtils.h
webcore/WebCore.cpp
webcore/WebCoreProxy.cpp
webcore/WebCoreProxy.h
webcore/WebkitGlue.cpp
webview/NavigationController.h
webview/PopupWidget.cpp
webview/PopupWidget.h
webview/RenderBuffer.cpp
webview/RenderBuffer.h
webview/WebView.cpp
webview/WebViewEvent.cpp
webview/WebViewProxy.cpp
webview/WebViewProxy.h
webview/WindowlessPlugin.h
)

# TODO should have a FindChromium.cmake file
SET(CHROMIUM_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../Chromium/src")

SET(CHROMIUM_SOURCES
${CHROMIUM_ROOT}/webkit/tools/test_shell/simple_appcache_system.cc
${CHROMIUM_ROOT}/webkit/tools/test_shell/simple_resource_loader_bridge.cc
${CHROMIUM_ROOT}/webkit/tools/test_shell/simple_socket_stream_bridge.cc
${CHROMIUM_ROOT}/webkit/tools/test_shell/test_shell_request_context.cc
)

INCLUDE_DIRECTORIES("${CHROMIUM_ROOT}")
INCLUDE_DIRECTORIES("${CHROMIUM_ROOT}/third_party/skia/include/config")
INCLUDE_DIRECTORIES("${CHROMIUM_ROOT}/third_party/skia/include/core")
INCLUDE_DIRECTORIES("${CHROMIUM_ROOT}/skia/ext")
INCLUDE_DIRECTORIES("${CHROMIUM_ROOT}/third_party/WebKit/JavaScriptCore")
INCLUDE_DIRECTORIES("${CHROMIUM_ROOT}/third_party/npapi")
INCLUDE_DIRECTORIES("${CHROMIUM_ROOT}/third_party/WebKit/WebKit/chromium/public")
INCLUDE_DIRECTORIES("${CHROMIUM_ROOT}/third_party/WebKit/WebKit/chromium/public/win")
INCLUDE_DIRECTORIES("${CHROMIUM_ROOT}/third_party/WebKit/WebCore/platform/text")
INCLUDE_DIRECTORIES("${CHROMIUM_ROOT}/third_party/WebKit/WebCore/history")
INCLUDE_DIRECTORIES("${CHROMIUM_ROOT}/third_party/icu/public/common")
INCLUDE_DIRECTORIES("${CHROMIUM_ROOT}/third_party/platformsdk_win2008_6_1/files/Include")

LINK_DIRECTORIES("${CHROMIUM_ROOT}/build/${CMAKE_CFG_INTDIR}/lib")
LINK_DIRECTORIES("${CHROMIUM_ROOT}/third_party/platformsdk_win2008_6_1/files/Lib")

ADD_DEFINITIONS(-DUNICODE)
ADD_DEFINITIONS(-DOSM_NONCLIENT_BUILD)
ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN)
ADD_DEFINITIONS(-DNOMINMAX)
ADD_DEFINITIONS(-DWEBKIT_USING_SKIA)
ADD_DEFINITIONS(-DSK_IGNORE_STDINT_DOT_H)
ADD_DEFINITIONS(-DU_HAVE_INT32_T=1)
ADD_DEFINITIONS(-DU_HAVE_UINT32_T=1)
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0600)
ADD_DEFINITIONS(-DWINVER=0x0600)
ADD_DEFINITIONS(-D_SECURE_ATL)

IF(MSVC)
# remove support for Exception handling
STRING(REPLACE "/GX" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT ${CMAKE_CXX_FLAGS_INIT})
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT})
ADD_DEFINITIONS(-D_HAS_EXCEPTIONS=0)
ENDIF(MSVC) 

SOURCE_GROUP( "_chromium" FILES ${CHROMIUM_SOURCES} )

ADD_LIBRARY(Awesomium SHARED ${SOURCES} ${CHROMIUM_SOURCES})

SET_TARGET_PROPERTIES(Awesomium PROPERTIES LINK_FLAGS /OPT:REF /OPT:ICF /OPT:NOWIN98)

SET_TARGET_PROPERTIES(Awesomium PROPERTIES LINK_INTERFACE_LIBRARIES "")

TARGET_LINK_LIBRARIES(Awesomium 
	avcodec-52
	avformat-52
	avutil-50
	app_base
	appcache
	base
	base_i18n
	breakpad_handler
	common
	common_constants
	database
	default_plugin
	Glue
	googleurl
	gtest
	icui18n
	icuuc
	libjpeg
	libpng
	libxslt
	libxml2
	media
	modp_b64
	net
	net_base
	ots
	pcre
	sdch
	skia
	sqlite3
	v8_base
	v8_snapshot
	WebCore
	webcore_bindings
	WebKit
	WTF
	zlib
	wininet
	version
	msimg32
	ws2_32
	usp10
	psapi
	dbghelp
	comctl32
	winmm
	urlmon
	libbzip2
	skia_sse2
)

# prevent propagation of static libraries used to build Awesomium
#SET_PROPERTY(TARGET Awesomium PROPERTY LINK_INTERFACE_LIBRARIES "")

